import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

/* Layout */
import Layout from '@/layout'

/**
 * Note: sub-menu only appear when route children.length >= 1
 * Detail see: https://panjiachen.github.io/vue-element-admin-site/guide/essentials/router-and-nav.html
 *
 * hidden: true                   if set true, item will not show in the sidebar(default is false)
 * alwaysShow: true               if set true, will always show the root menu
 *                                if not set alwaysShow, when item has more than one children route,
 *                                it will becomes nested mode, otherwise not show the root menu
 * redirect: noRedirect           if set noRedirect will no redirect in the breadcrumb
 * name:'router-name'             the name is used by <keep-alive> (must set!!!)
 * meta : {
    roles: ['admin','editor']    control the page roles (you can set multiple roles)
    title: 'title'               the name show in sidebar and breadcrumb (recommend set)
    icon: 'svg-name'/'el-icon-x' the icon show in the sidebar
    breadcrumb: false            if set false, the item will hidden in breadcrumb(default is true)
    activeMenu: '/example/list'  if set path, the sidebar will highlight the path you set
  }
 */

/**
 * constantRoutes
 * a base page that does not have permission requirements
 * all roles can be accessed
 */
// 公共页面
export const constantRoutes = [
  // 登录
  {
    path: '/login',
    component: () => import('@/views/login/index'),
    meta: { title: 'login', icon: '' },
    hidden: true
  },
  // 注册
  {
    path: '/register',
    component: () => import('@/views/login/register'),
    meta: { title: 'register', icon: '' },
    hidden: true
  },
  
  // 首页
  {
    path: '/',
    component: Layout,
    redirect: '/index',
    meta: { title: '首页', icon: 'dashboard' },
    children: [
      {
        path: 'index',
        name: 'index',
        component: () => import('@/viewsF/index/index'),
        meta: { title: '首页', icon: 'el-icon-s-home' }
      },
    //   {
    //   path: 'dashboard',
    //   name: 'Dashboard',
    //   component: () => import('@/views/index-page/index'),
    //   meta: { title: '工作台', icon: 'dashboard' }
    // }
    ]
  },
  // 修改密码
  {
    path: '/ChangePassword',
    component: Layout,
    redirect: '/ChangePassword/index',
    alwaysShow: true,
    hidden: true,
    redirect: 'noRedirect',
    meta: { title: '修改密码', icon: 'el-icon-s-tools' },
    children: [{
      path: 'index',
      name: 'index',
      component: () => import('@/viewsF/ChangePassword/index'),
      meta: { title: '修改密码', icon: '' }
    },]
  },
  // 权限管理
  {
    path: '/jurisdictionManage',
    component: Layout,
    redirect: '/index',
    alwaysShow: true,
    hidden: true,
    redirect: 'noRedirect',
    meta: { title: '权限管理', icon: 'el-icon-s-tools' },
    children: [{
      path: 'index',
      name: 'index',
      component: () => import('@/viewsF/jurisdictionManage/index'),
      meta: { title: '权限管理', icon: '' }
    },
    {
      path: 'account',
      name: 'account',
      component: () => import('@/viewsF/jurisdictionManage/role/accountNumManage'),
      meta: { title: '账号管理', icon: '' }
    }]
  },
  // 园区管理--发布
  {
    path: '/parkManage',
    component: Layout,
    redirect: '/release',
    alwaysShow: true,
    redirect: 'noRedirect',
    redirect: 'noRedirect',
    meta: { title: '园区管理', icon: 'el-icon-office-building' },
    children: [{
      path: 'release',
      name: 'release',
      hidden: true,
      component: () => import('@/viewsF/parkManage/release/index'),
      meta: { title: '发布公告', icon: '' }
    },
    {
      path: 'releaseShow',
      name: 'releaseShow',
      hidden: true,
      component: () => import('@/viewsF/parkManage/release/releaseShow'),
      meta: { title: '公告列表', icon: '' }
    },
    {
      path: 'releaseDetails',
      name: 'releaseDetails',
      component: () => import('@/viewsF/parkManage/release/releaseDetails'),
      hidden: true, // 不在侧边栏显示
      meta: { title: '公告详情展示', icon: '' }
    },
    {
      path: 'build',
      name: 'Build',
      component: () => import('@/views/parkman/build'),
      meta: { title: '楼宇管理', icon: '' }
    },
    {
      path: 'houseInfo',
      name: 'houseInfo',
      component: () => import('@/viewsF/parkManage/house/index'),
      meta: { title: '办公室信息', icon: '' }
    },
    {
      path: 'parkInfo',
      name: 'parkInfo',
      component: () => import('@/viewsF/parkInfo/index'),
      meta: { title: '园区信息', icon: '' }
    },

    // {
    //   path: 'room',
    //   name: 'Room',
    //   component: () => import('@/views/parkman/room'),
    //   meta: { title: '房间管理', icon: '' }
    // }
  ]
  },
  // 招商发布
  {
    path: '/RecruitAndRelease',
    component: Layout,
    redirect: '/release_info',
    alwaysShow: true,
    redirect: 'noRedirect',
    meta: { title: '招商发布', icon: 'el-icon-monitor' },
    children: [{
      path: 'release_info',
      name: 'release_info',
      component: () => import('@/viewsF/RecruitAndRelease/release_info/index'),
      meta: { title: '招商信息发布', icon: '' }
    },{
      path: 'Approval_info',
      name: 'Approval_info',
      component: () => import('@/viewsF/RecruitAndRelease/Approval_info/index'),
      meta: { title: '招商信息审批', icon: '' }
    },{
      path: 'approval_details',
      name: 'approval_details',
      hidden: true,
      component: () => import('@/viewsF/RecruitAndRelease/Approval_info/approval_details'),
      meta: { title: '招商信息审批详情', icon: '' , activeMenu: '/RecruitAndRelease/Approval_info'}
    },{
      path: 'search_info',
      name: 'search_info',
      component: () => import('@/viewsF/RecruitAndRelease/search_info/index'),
      meta: { title: '招商信息查询', icon: '' }
    },]
  },
  // 企业入驻审批
  {
    path: '/enterpriseManage',
    component: Layout,
    redirect: '/info_Approval',
    alwaysShow: true,
    redirect: 'noRedirect',
    meta: { title: '企业管理', icon: 'el-icon-school' },
    children: [{
      path: 'SettleIn_Approval',
      name: 'SettleIn_Approval',
      component: () => import('@/viewsF/enterpriseManage/SettleIn_Approval/index'),
      meta: { title: '企业入驻审批', icon: '' }
    },{
      // 信息管理
      path: 'Info_Manage',
      name: 'Info_Manage',
      component: () => import('@/viewsF/enterpriseManage/Info_Manage/SettleInInfo'),
      meta: { title: '入驻信息查询', icon: '' }
    },{
      path: 'info_Approval',
      name: 'info_Approval',
      component: () => import('@/viewsF/enterpriseManage/info_Approval/index'),
      meta: { title: '企业信息审批', icon: '' }
    },{
      path: 'info_Approval_Details',
      name: 'info_Approval_Details',
      hidden: true,
      component: () => import('@/viewsF/enterpriseManage/info_Approval/info_Approval_Details'),
      meta: { title: '企业信息审批详情', icon: '', activeMenu: '/enterpriseManage/info_Approval' }
    },{
      path: 'Info_Manage_son',
      name: 'Info_Manage_son',
      hidden: true,
      component: () => import('@/viewsF/enterpriseManage/Info_Manage/Info_Manage_son'),
      meta: { title: '企业信息管理修改', icon: '', activeMenu: '/enterpriseManage/Info_Manage' }
    },{
      path: 'RentRefund_Approval',
      name: 'RentRefund_Approval',
      component: () => import('@/viewsF/enterpriseManage/RentRefund_Approval/index'),
      meta: { title: '退租审批', icon: '' }
    },{
      path: 'RentRefund_Approval_son',
      name: 'RentRefund_Approval_son',
      hidden: true,
      component: () => import('@/viewsF/enterpriseManage/info_Approval/info_Approval_Details'),
      meta: { title: '退租审批详情', icon: '', activeMenu: '/enterpriseManage/RentRefund_Approval' }
    },{
      path: 'RentRefund_Search',
      name: 'RentRefund_Search',
      component: () => import('@/viewsF/enterpriseManage/Info_Manage/index'),
      meta: { title: '退租企业查询', icon: '' }
    },{
      path: 'RentRefund_Search_son',
      name: 'RentRefund_Search_son',
      hidden: true,
      component: () => import('@/viewsF/enterpriseManage/RentRefund_Search/RentRefund_Search_son'),
      meta: { title: '退租企业详情', icon: '', activeMenu: '/enterpriseManage/RentRefund_Search' }
    },{
      path: 'info_change',
      name: 'info_change',
      hidden: true,
      component: () => import('@/viewsF/enterpriseManage/Info_Manage/index'),
      meta: { title: '信息变更', icon: '' }
    },{
      path: 'info_change_son',
      name: 'info_change_son',
      hidden: true,
      component: () => import('@/viewsF/enterpriseManage/Info_Change/info_change_son'),
      meta: { title: '信息变更详情', icon: '' , activeMenu: '/enterpriseManage/info_change' }
    },]
  },
  // 新闻公告
  // {
  //   path: '/news',
  //   component: Layout,
  //   redirect: '/news_release',
  //   alwaysShow: true,
  //   meta: { title: '新闻公告', icon: 'el-icon-s-tools' },
  //   children: [{
  //     path: 'news_release',
  //     name: 'news_release',
  //     component: () => import('@/viewsF/news/release/index'),
  //     meta: { title: '新闻咨询', icon: '' }
  //   },{
  //     path: 'add_article',
  //     name: 'add_article',
  //     component: () => import('@/viewsF/news/release/add_article'),
  //     meta: { title: '发布公告', icon: '' }
  //   },{
  //     path: 'news_draft',
  //     name: 'news_draft',
  //     component: () => import('@/viewsF/news/release/draft'),
  //     meta: { title: '草稿箱', icon: '' }
  //   },{
  //     path: 'info_approval',
  //     name: 'info_approval',
  //     component: () => import('@/viewsF/news/info_approval/index'),
  //     meta: { title: '信息审批', icon: '' }
  //   },{
  //     path: 'info_approval_son',
  //     name: 'info_approval_son',
  //     hidden:true,
  //     component: () => import('@/viewsF/news/info_approval/approval'),
  //     meta: { title: '信息审批详情', icon: '' }
  //   },]
  // },

  // 新闻和公告
  {
    path: '/news',
    component: Layout,
    redirect: '/news/news_consult',
    alwaysShow: true,
    // 面包屑中不可点击
    redirect: 'noRedirect',
    meta: { title: '新闻公告', icon: 'el-icon-monitor' },
    children: [{
        path: 'news_consult',
        name: 'news_consult',
        redirect: 'noRedirect',
        component: () => import('@/viewsF/newsAndNotice/index'),
        meta: { title: '新闻咨询', icon: '' },
        children: [{
          path: 'news_consult_index',
          name: 'news_consult_index',
          component: () => import('@/viewsF/newsAndNotice/news/index'),
          meta: { title: '首页', icon: '' }
        },{
          path: 'add_article',
          name: 'add_article',
          hidden:true,
          component: () => import('@/viewsF/newsAndNotice/news/add_article'),
          meta: { title: '发布新闻', icon: '', activeMenu: '/news/news_consult/news_consult_index' }
        },{
          path: 'news_consult__draft',
          name: 'news_consult__draft',
          component: () => import('@/viewsF/newsAndNotice/news/draft'),
          meta: { title: '草稿箱', icon: '' }
        },{
          path: 'add_article_draft',
          name: 'add_article_draft',
          hidden:true,
          component: () => import('@/viewsF/newsAndNotice/news/add_article'),
          meta: { title: '发布新闻', icon: '', activeMenu: '/news/news_consult/news_consult__draft' }
        },{
          path: 'newsinfo_details',
          name: 'newsinfo_details',
          hidden:true,
          component: () => import('@/viewsF/newsAndNotice/details'),
          meta: { title: '详情', icon: '', activeMenu: '/news/news_consult/news_consult_index'  }
        },]
      },{
        path: 'Notice_push',
        name: 'Notice_push',
        redirect: 'noRedirect',
        component: () => import('@/viewsF/newsAndNotice/index'),
        meta: { title: '公告推送', icon: '' },
        children: [{
          path: 'Notice_push_index',
          name: 'Notice_push_index',
          component: () => import('@/viewsF/newsAndNotice/Notice_push/index'),
          meta: { title: '首页', icon: '' }
        },{
          path: 'Notice_push_add',
          name: 'Notice_push_add',
          hidden:true,
          component: () => import('@/viewsF/newsAndNotice/Notice_push/add_article'),
          meta: { title: '发布公告', icon: '' , activeMenu: '/news/Notice_push/Notice_push_index' }
        },{
          path: 'Notice_push_draft',
          name: 'Notice_push_draft',
          component: () => import('@/viewsF/newsAndNotice/Notice_push/draft'),
          meta: { title: '草稿箱', icon: '' }
        },{
          path: 'Notice_push_add_draft',
          name: 'Notice_push_add_draft',
          hidden:true,
          component: () => import('@/viewsF/newsAndNotice/Notice_push/add_article'),
          meta: { title: '发布公告', icon: '' , activeMenu: '/news/Notice_push/Notice_push_draft' }
        },{
          path: 'Noticeinfo_details',
          name: 'Noticeinfo_details',
          hidden:true,
          component: () => import('@/viewsF/newsAndNotice/details'),
          meta: { title: '详情', icon: '', activeMenu: '/news/Notice_push/Notice_push_index'  }
        },]
      },{
        path: 'info_approval',
        name: 'info_approval',
        component: () => import('@/viewsF/newsAndNotice/info_approval/index'),
        meta: { title: '信息审批', icon: '' },
      },{
        path: 'info_approval_son',
        name: 'info_approval_son',
        hidden:true,
        component: () => import('@/viewsF/newsAndNotice/info_approval/approval'),
        meta: { title: '信息审批详情', icon: '', activeMenu: '/news/info_approval'  }
      },{
        path: 'NewsAndNoticeInfo_manage',
        name: 'NewsAndNoticeInfo_manage',
        component: () => import('@/viewsF/newsAndNotice/info_manage'),
        meta: { title: '信息撤回', icon: '' }
      },]
  },
  
  
  // 信息采集
  {
    path: '/gather',
    component: Layout,
    hidden: true,
    redirect: '/gather/enterprise',
    alwaysShow: true,
    redirect: 'noRedirect',
    meta: { title: '信息采集', icon: 'el-icon-s-tools' },
    children: [{
        path: 'enterprise',
        name: 'enterprise',
        component: () => import('@/viewsF/gather/enterprise/index'),
        meta: { title: '企业信息采集', icon: '' },
      }
    ]
  },
  //数据填报
  {
    path: '/data_filling',
    component: Layout,
    redirect: '/data_filling/table1',
    alwaysShow: true,
    redirect: 'noRedirect',
    meta: { title: '数据填报', icon: 'el-icon-data-analysis' },
    children: [{
        path: 'fill',
        name: 'fill',
        component: () => import('@/viewsF/Data_filling/index'),
        meta: { title: '数据填报', icon: '' },
      },
      {
        path: 'data_search',
        name: 'data_search',
        component: () => import('@/viewsF/Data_filling/formInfoSearch'),
        meta: { title: '表单查询', icon: '' },
      },
      {
        path: 'urge_search',
        name: 'urge_search',
        component: () => import('@/viewsF/Data_filling/Urge'),
        meta: { title: '表单催收', icon: '' },
      }
    ]
  },
  // 物业报修
  {
    path: '/Property_manage',
    component: Layout,
    redirect: '/Property_manage/fix',
    alwaysShow: true,
    redirect: 'noRedirect',
    meta: { title: '物业管理', icon: 'el-icon-s-tools' },
    children: [{
        path: 'fix',
        name: 'fix',
        component: () => import('@/viewsF/fix/index'),
        meta: { title: '报修详情', icon: '' },
      }
    ]
  },
  // 修改密码审核
  {
    path: '/userInfo_approval',
    component: Layout,
    redirect: '/password_approval',
    alwaysShow: true,
    redirect: 'noRedirect',
    meta: { title: '用户信息审核', icon: 'el-icon-user-solid' },
    children: [{
      path: 'password_approval',
      name: 'password_approval',
      component: () => import('@/viewsF/userInfo_approval/password_approval/index'),
      meta: { title: '修改密码审核', icon: '' }
    }]
  },
  // 商品购买
  {
    path: '/buy_goods',
    component: Layout,
    redirect: '/buy_goods_index',
    alwaysShow: true,
    redirect: 'noRedirect',
    meta: { title: '商品购买', icon: 'el-icon-shopping-cart-full' },
    children: [{
      path: 'buy_goods_index',
      name: 'buy_goods_index',
      component: () => import('@/viewsF/buy_goods/buy_goods/index'),
      meta: { title: '商品购买', icon: '' }
    }]
  },
  
    
]
// 根据角色分权限的页面
export const asyncRoutes = [
  // 业务表单
  {
    path: '/form',
    name: '业务表单',
    component: Layout,
    sort: 2,
    hidden: true,
    redirect: '/formbus/businesstable/index',
    meta: { title: '业务表单', icon: 'form', noCache: true },
    children: [
      {
        path: '/formbus/design/app',
        component: () => import('@/views/formbus/design/app'),
        name: 'formModelerIndex',
        meta: { title: '表单设计器', icon: 'form', noCache: true },
        hidden: true
      },
      {
        path: '/formbus/design/modeler',
        component: () => import('@/views/formbus/design/modeler'),
        name: 'formModeler',
        meta: { title: '表单设计器', icon: 'form', noCache: true },
        hidden: true
      },
      {
        path: '/formbus/design/versionManager',
        component: () => import('@/views/formbus/design/versionManager'),
        name: 'formVersionManager',
        meta: { title: '版本管理', icon: 'form', noCache: true },
        hidden: true
      },
      {
        path: '/formbus/businesstable/index',
        component: () => import('@/views/formbus/businesstable/index'),
        name: 'businesstableIndex',
        meta: { title: '业务实体管理', icon: 'form', noCache: true }
      },
      {
        path: '/formbus/businesstable/inner/index',
        component: () => import('@/views/formbus/businesstable/inner/index'),
        name: 'businessTableInnerAdd',
        meta: { title: '新增业务实体', icon: 'form', noCache: true },
        hidden: true
      },
      {
        path: '/formbus/businessobject/index',
        component: () => import('@/views/formbus/businessobject/index'),
        name: 'businessObjIndex',
        meta: { title: '业务对象', icon: 'form', noCache: true }
      },
      {
        path: '/form/design/index',
        component: () => import('@/views/formbus/design/index'),
        name: 'designForm',
        meta: { title: '表单模型', icon: 'form', noCache: true }
      },
      {
        path: '/form/customDialog/index',
        component: () => import('@/views/formbus/customdialog/index'),
        name: 'customDialogList',
        meta: { title: '对话框管理', icon: 'form', noCache: true }
      },
      {
        path: '/formbus/businessobject/add',
        component: () => import('@/views/formbus/businessobject/add'),
        name: 'businessObjAdd',
        meta: { title: '新增业务对象', icon: 'form', noCache: true },
        hidden: true
      },
      {
        path: '/formbus/customdialog/add',
        component: () => import('@/views/formbus/customdialog/add'),
        name: 'customdialogAdd',
        meta: { title: '对话框', icon: 'form', noCache: true },
        hidden: true
      }
    ],
  },
  // 园区管理
  // {
  //   path: '/parkman',
  //   component: Layout,
  //   redirect: '/parkman/build',
  //   name: 'Parkman',
  //   meta: { title: '园区管理', icon: 'el-icon-s-help' },
  //   children: [
  //     {
  //       path: 'build',
  //       name: 'Build',
  //       component: () => import('@/views/parkman/build'),
  //       meta: { title: '楼宇管理', icon: 'table' }
  //     },
  //     {
  //       path: 'room',
  //       name: 'Room',
  //       component: () => import('@/views/parkman/room'),
  //       meta: { title: '房间管理', icon: 'tree' }
  //     }
  //   ]
  // },
  // 我的事项
  {
    path: '/task',
    name: '我的事项',
    sort: 7,
    component: Layout,
    hidden: true,
    redirect: '/bpm/task/index',
    meta: { title: '我的事项', icon: 'nested', noCache: true },
    children: [
      {
        path: '/bpm/index',
        component: () => import('@/views/bpm/index'),
        name: 'bpmIndex',
        meta: { title: '首页', icon: '', noCache: true }
      },
      {
        path: '/bpm/task/index',
        component: () => import('@/views/bpm/task/index'),
        name: 'myTask',
        meta: { title: '我的任务', icon: '', noCache: true }
      },
      {
        path: '/bpm/task/timeout',
        component: () => import('@/views/bpm/task/timeout'),
        name: 'timeoutMyTask',
        meta: { title: '超时任务', icon: '', noCache: true }
      },
      {
        path: '/bpm/histask/index',
        component: () => import('@/views/bpm/histask/index'),
        name: 'histaskIndex',
        meta: { title: '已办任务', icon: '', noCache: true }
      },
      {
        path: '/bpm/task/handleTask',
        component: () => import('@/views/bpm/task/handle'),
        name: 'handleRunTask',
        meta: { title: '办理任务', icon: '', noCache: true },
        hidden: true
      },
      {
        path: 'bpm/histask/details',
        component: () => import('@/views/bpm/histask/details'),
        name: 'handleHisTaskDetails',
        meta: { title: '历史任务详情', icon: '', noCache: true },
        hidden: true
      },
      {
        path: '/bpm/wfmoduleIndex/ruIndex',
        component: () => import('@/views/bpm/wfmodule/index'),
        name: 'wfmoduleIndex',
        meta: { title: '发起流程', icon: '', noCache: true }
      },
      {
        path: '/bpm/wfmoduleIndex/start/ruIndex',
        component: () => import('@/views/bpm/wfmodule/start'),
        name: 'wfmoduleStart',
        meta: { title: '发起申请', icon: '', noCache: true },
        hidden: true
      },
      {
        path: '/bpm/wfmoduleIndex/start/draft',
        component: () => import('@/views/bpm/wfmodule/draft'),
        name: 'ru_draft',
        meta: { title: '草稿', icon: '', noCache: true }
      },
      {
        path: '/bpm/wfmoduleIndex/start/draftStart',
        component: () => import('@/views/bpm/wfmodule/draftStart'),
        name: 'draftStart',
        meta: { title: '发起申请', icon: '', noCache: true },
        hidden: true
      },
      {
        path: '/bpm/startup/ruIndex',
        component: () => import('@/views/bpm/startup/ruIndex'),
        name: 'startupRuIndex',
        meta: { title: '运行', icon: '', noCache: true }
      },
      {
        path: '/bpm/startup/hiIndex',
        component: () => import('@/views/bpm/startup/hiIndex'),
        name: 'hiIndex',
        meta: { title: '办结', icon: '', noCache: true }
      },
      {
        path: '/bpm/startup/runDetails',
        component: () => import('@/views/bpm/startup/runDetails'),
        name: 'runDetails',
        meta: { title: '任务明细', icon: '', noCache: true },
        hidden: true
      },
      {
        path: '/bpm/startup/hisDetails',
        component: () => import('@/views/bpm/startup/hisDetails'),
        name: 'hisDetails',
        meta: { title: '任务明细', icon: '', noCache: true },
        hidden: true
      }

    ],
  },
  // 入驻管理
  {
    path: '/inman',
    component: Layout,
    hidden: true,
    meta: { title: '入驻管理', icon: 'form' },
    children: [
      {
        path: 'inParkApply',
        name: 'InParkApply',
        component: () => import('@/views/inman/inParkApply'),
        meta: { title: '入园申请', icon: 'form' }
      },
      {
        path: 'inApply',
        name: 'InApply',
        component: () => import('@/views/inman/inApply'),
        meta: { title: '入驻申请', icon: 'form' }
      },
      {
        path: 'toInApply',
        name: 'toInApply',
        component: () => import('@/views/inman/toInApply'),
        meta: { title: '迁入申请', icon: 'form' }
      }
    ]
  },
  // 企业服务
  {
    path: '/admin',
    component: Layout,
    redirect: '/user',
    alwaysShow: true,
    hidden: true,
    meta: { title: '企业服务', icon: 'user' },
    children: [
      {
        path: 'user',
        name: 'CustomerMan',
        component: () => import('@/views/enterprise_service/customerMan'),
        meta: { title: '客户管理', icon: 'form' }
      },
      {
        path: 'menu',
        name: 'MenuMan',
        component: () => import('@/views/enterprise_service/menuMan'),
        meta: { title: '菜单管理', icon: 'form' }
      }
    ]
  }
]
// 公共页面--但是渲染的时候必须放在最后
export const notfound = [
  {
    path: '/404',
    component: () => import('@/views/404'),
    hidden: true
  },
  // 404 page must be placed at the end !!!
  { path: '*', redirect: '/404', hidden: true }
]
const createRouter = () => new Router({
  // mode: 'history', // require service support
  scrollBehavior: () => ({ y: 0 }),
  routes: constantRoutes
})

const router = createRouter()

// Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
export function resetRouter() {
  const newRouter = createRouter()
  router.matcher = newRouter.matcher // reset router
}

export default router
